﻿using System.Linq.Expressions;

namespace WT.OpenIddict.Domain.Services;

public static class LinqExtension
{
    public static IQueryable<T> WhereIf<T>(this IQueryable<T> query, bool Cordtion, Expression<Func<T, bool>> preCredit)
    {
        return Cordtion ? query.Where(preCredit) : query;
    }


    public static IEnumerable<T> WhereIf<T>(this IEnumerable<T> query, bool Cordtion, Func<T, bool> preCredit)
    {
        return Cordtion ? query.Where(preCredit) : query;
    }
}